<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('上传总信息列表')"/>
    <style type="text/css">
        .img-circle {
            max-width: 70px;
            border-radius: 0;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>标题名称：</label>
                            <input type="text" name="titleName"/>
                        </li>
                        <li>
                            <label>封面图：</label>
                            <input type="text" name="surfacePlotUrl"/>
                        </li>
                        <li>
                            <label>文件分类字典id：</label>
                            <input type="text" name="fileClassDictId"/>
                        </li>
                        <li>
                            <label>文件类型 ：</label>
                            <select name="fileType">
                                <option value="">所有</option>
                                <option value="-1">代码生成请选择字典属性</option>
                            </select>
                        </li>
                        <li>
                            <label>gif省略图：</label>
                            <input type="text" name="videoGifUrl"/>
                        </li>
                        <li>
                            <label>上传时间：</label>
                            <input type="text" class="time-input" placeholder="请选择上传时间" name="updateDate"/>
                        </li>
                        <li>
                            <label>文件数量：</label>
                            <input type="text" name="fileCount"/>
                        </li>
                        <li>
                            <label>浏览次数：</label>
                            <input type="text" name="browseCount"/>
                        </li>
                        <li>
                            <label>最新浏览时间：</label>
                            <input type="text" class="time-input" placeholder="请选择最新浏览时间" name="browseNewDate"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:info:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:info:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:info:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:info:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:info:remove')}]];
    var hz_file_class = [[${@dict.getType('hz_file_class')}]];
    var prefix = ctx + "fileUP";

    $(function () {
        var options = {
            url: prefix + "/list",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "上传总信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'titleName',
                    title: '标题名称'
                },
                {
                    field: 'surfacePlotUrl',
                    title: '封面图',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value, '/profile/avatar');
                    }
                },
                {
                    field: 'fileClassDictId',
                    title: '文件分类',
                    formatter: function (value, row, index) {
                        for (var i = 0; i < hz_file_class.length; i++) {
                            var dict = hz_file_class[i];
                            if (dict.dictValue == value)
                                return dict.dictLabel;
                        }

                    }
                },
                {
                    field: 'fileType',
                    title: '文件类型',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return '套图';
                        } else if (value == 2) {
                            return '视频';
                        }
                    }
                },
                {
                    field: 'videoGifUrl',
                    title: '视频省略图',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value, '/profile/avatar');
                    }
                },
                {
                    field: 'updateDate',
                    title: '上传时间'
                },
                {
                    field: 'fileCount',
                    title: '文件数量'
                },
                {
                    field: 'browseCount',
                    title: '浏览次数'
                },
                {
                    field: 'browseNewDate',
                    title: '最新浏览时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>